package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 推广奖励类型（0-无，1-佣金，2-其他权益，3-积分）
 */
public enum RewardTypeEnum {

    NONE(0, "无"),
    COMMISSION(1, "佣金"),
    OTHER(2, "权益"),
    POINTS(3, "积分"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    RewardTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static RewardTypeEnum typeOf(Integer value) {
        RewardTypeEnum[] values = RewardTypeEnum.values();
        for (RewardTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static RewardTypeEnum typeOf(String name) {
        RewardTypeEnum[] values = RewardTypeEnum.values();
        for (RewardTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }
}
